local CommonOHOH = _G.CommonOHOH;
local M = CommonOHOH.class.new(script, CommonOHOH.files.TaskBase());
--任务内容: 在关卡范围内，击杀多杀怪

function M.new(...)
	return M(...);
end;

function M.ctor(self,player,finish,tId,minLevel,maxlevel)--构造函数
    self.minLevel=minLevel
    self.maxLevel=maxlevel
	M.super.ctor(self,player,finish,tId);
end;

function M.ClientInit(self,uiFuc)--客户端初始化
    M.super.ClientInit(self);

    if not self:IsComplete() then
        local con=self.Player.KillMonsterEvent:Connect(function(monster,attacker)
            local lvId=monster:GetLevelIdAndMonsterId()
            if lvId>=self.minLevel  and lvId<= self.maxLevel then
                self:UpdateProgress(1)
            end
        end)
        self:AddConnect(con)
    end
end

function M.ServerInit(self)--服务器初始化
    M.super.ServerInit(self);
    if not self:IsComplete() then
        local con=self.Player.KillMonsterEvent:Connect(function(levelId,monsterId)
            local lvId=levelId
            if lvId>=self.minLevel  and lvId<= self.maxLevel then
                self:UpdateProgress(1)
            end
        end)
        self:AddConnect(con)
    end
end

function M.dtor(self)--析构函数
    M.super.dtor(self);
end;

return M